<app-overview [title]="title" [projectUuid]='projectUuid' [refreshAppOverview]='overviewAppData' [refreshMark]='overviewAppMark'></app-overview>

<div nz-row class="margin-example">
  <div nz-col [nzSpan]="6" style="float:left">
    <nz-input-group [nzSuffix]="suffixIconSearch" style="width: 400px">
      <input type="text" nz-input placeholder="请输入搜索内容...">
    </nz-input-group>
    <ng-template #suffixIconSearch>
      <i nz-icon type="search"></i>
    </ng-template>
  </div>
  <div nz-col [nzSpan]="18" style="text-align: right">
    <button nz-button *szAcl="['groupadmin']" nzType="primary" (click)="createApplicationModal()">
      <i nz-icon type="plus" theme="outline"></i>创建应用
    </button>
  </div>
</div>

<div class="custom_table">
  <nz-table #ajaxTable nzShowSizeChanger [nzFrontPagination]="false" [nzData]="dataSet" [nzTotal]="total"
    [(nzPageIndex)]="pageIndex" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getApplicationPage()"
    (nzCurrentPageDataChange)="currentPageDataChange($event)" (nzPageSizeChange)="getApplicationPage(true)">
    <thead (nzSortChange)="sort($event)" nzSingleSort>
      <tr>
        <th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate"
          (nzCheckedChange)="checkAll($event)"></th>
        <th nzShowSort nzSortKey="name">应用名称</th>
        <th>应用路径</th>
        <th>组件数</th>
        <th>严重性</th>
        <th>CVE数</th>
        <th>CNNVD数</th>
        <th>最后更新的时间</th>
        <th>更多</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of ajaxTable.data">
        <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="refreshStatus()"></td>
        <td>
          <a [routerLink]="[ '/layout/application/app-detail']"
            [queryParams]="{appUuid: data.appUuid,title: '应用'}">{{ data.name }}</a>
        </td>
        <td>{{data.path}}</td>
        <td>
          {{data.jarCount}}
        </td>
        <td>
          <span class="grade-high" *ngIf="data.importance === '2'"></span>
          <span class="grade-medium" *ngIf="data.importance === '1'"></span>
          <span class="grade-low" *ngIf="data.importance === '0'"></span>
          &nbsp;
          {{data.importanceName}}
        </td>
        <td>
          {{data.cveCount}}
        </td>
        <td>
          {{data.cnnvdCount}}
        </td>
        <td>
          {{data.modifyTime | date: "yyyy:MM:dd hh:mm:ss" }}
        </td>
        <td>
          <nz-dropdown>
            <a nz-dropdown>
              更多 <i nz-icon type="down"></i>
            </a>
            <ul nz-menu nzSelectable>
              <li nz-menu-item>
                <a (click)="uploadWarModal(data.appUuid)">上传war</a>
              </li>
              <li nz-menu-item>
                <a (click)="uploadDependCheckModal(data.appUuid)">上传dependency-check报告</a>
              </li>
              <li nz-menu-item>
                <a (click)="deleteApp(data.appUuid)">删除</a>
              </li>
            </ul>
          </nz-dropdown>
        </td>
      </tr>
    </tbody>
  </nz-table>
</div>